<?php

namespace app\technician\controller;

/** 控制器类引入区 **/
use app\common\controller\Smscm;

/** 模型类引入区 **/

use app\common\model\Goods;
use app\common\model\GoodsCategory;
use app\common\model\Product as ProductM;

/** 核心或第三方类引入区 **/

use app\common\model\QueueRule;
use app\common\model\Store as Store_Model;
use think\Db;
use think\Validate;

/**
 * 门店控制器
 */
class Store extends Home
{
    public $noNeedLogin = [];

    /**
     * 获取当前门店活动
     */
    public function activity(){
        if ($this->request->isPost()) {
            $data = Db::name('qt_data_activity')
                ->field('id,name')
                ->where(['store_id'=>$this->userInfo['store_id']])
                ->order('id desc')
                ->select();
            $this->result('查询成功', $data, 200);
        }
        $this->result('无效的请求', '', 204);
    }

    /**
     * 设置门店--获取门店详情
     */
    public function detail()
    {

        if ($this->request->isPost())
        {
            $info = Store_Model::where('id',$this->userInfo['store_id'])->find();
            $queue_rule =QueueRule::get(['store_id'=>$this->userInfo['store_id']]);

            $info['queue_type'] = isset($queue_rule)&&$queue_rule['type']==1?'大轮排':'上钟点排数';

            $this->result('获取成功',$info,200);
        }else{
            $this->result('请求错误','',204);
        }

    }

}
